function Person(name) {
  this.name = name||'匿名';
  this.sayHi = function() {
    console.log(`Hi, I'm ${this.name}`);
  };
//   return undefined
}
Person.prototype.comName = 'com_person';

const p1 = new Person('Alice');
const p2 = new Person();
// p1.sayHi(); // 输出: Hi, I'm Alice、
console.dir(Person);
console.dir(p1);
console.log(p1.name, p2.name,p1.comName,p2.comName,p1);
console.log('-----------------');
function Parent() { this.a = 1; }
function Child() { this.b = 2; }

Child.prototype = new Parent();
const c = new Child();
const pp = new Parent();
console.log(c.a); // 1 (通过原型链继承)
console.dir(c);
console.dir(pp);
console.dir(Parent.__proto__===Function.prototype);

